package com.qeeyou.apps.android.craftsman.activity.publish;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import com.qeeyou.apps.android.craftsman.MainActivity;
import com.qeeyou.apps.android.craftsman.R;

public class  PublishSuccessActivity extends Activity {

    private ImageView btnBack;
    private ImageView btnImage;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_publish_success);

        setView();
        setEvent();

    }

    private void setView() {
        btnBack = (ImageView) this.findViewById(R.id.btnBack4PublishSuccess);
        btnImage = (ImageView) this.findViewById(R.id.btnImage4PublishSuccess);
    }

    private void setEvent() {
        btnBack.setOnClickListener(onBackClickListener);
        btnImage.setOnClickListener(onKnownClickListener);
    }

    //返回按钮
    private View.OnClickListener onBackClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            PublishSuccessActivity.this.finish();
        }
    };

    //取消
    private View.OnClickListener onKnownClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(PublishSuccessActivity.this, "知道了！", Toast.LENGTH_SHORT).show();
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    Intent intent = new Intent(PublishSuccessActivity.this, MainActivity.class);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    PublishSuccessActivity.this.startActivity(intent);
                }
            }, 500);
        }
    };
}
